<!DOCTYPE html>
<html lang="cn" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>自定义表单信息 Field Form</title>
    <meta name="renderer" content="webkit"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
    <link rel="stylesheet" th:href="@{/statics/layui/css/layui.css}" media="all"/>
    <link rel="stylesheet" th:href="@{/statics/style/admin.css}" media="all"/>
</head>
<body>

<div class="layui-form" lay-filter="layuiadmin-form-field" id="layuiadmin-form-field" style="padding: 20px 30px 0 0;">
    <div class="layui-form-item">
        <label class="layui-form-label">标题</label>
        <div class="layui-input-block">
            <input type="text" name="title" lay-verify="required" autocomplete="off" placeholder="请输入字段标题"
                   class="layui-input" th:value="${field.title}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">名称</label>
        <div class="layui-input-block">
            <input type="text" name="name" lay-verify="required" autocomplete="off" placeholder="请输入字段名称"
                   class="layui-input" th:value="${field.name}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">类型</label>
        <div class="layui-input-block">
            <input type="radio" name="type" value="input" title="单行文本" th:checked="${'input' == field.type ? 'true':'false'}"/>
            <input type="radio" name="type" value="textarea" title="多行文本" th:checked="${'textarea' == field.type ? 'true':'false'}"/>
            <input type="radio" name="type" value="picture" title="图片上传" th:checked="${'picture' == field.type ? 'true':'false'}"/>
            <input type="radio" name="type" value="attachment" title="附件上传" th:checked="${'attachment' == field.type ? 'true':'false'}"/>
            <input type="radio" name="type" value="radiobox" title="单选按钮" th:checked="${'radiobox' == field.type ? 'true':'false'}"/>
            <input type="radio" name="type" value="checkbox" title="多选按钮" th:checked="${'checkbox' == field.type ? 'true':'false'}"/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">选择内容值</label>
        <div class="layui-input-block">
            <textarea name="dvalues" placeholder="请输入内容值" class="layui-textarea">[[${field.dvalues}]]</textarea>
            <div class="layui-form-mid layui-word-aux">只在类型为单选、多选或关联模型时填写有效。</div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">提示</label>
        <div class="layui-input-block">
            <input type="text" name="tips" autocomplete="off" placeholder="请输入字段提示" class="layui-input" th:value="${field.tips}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">必填</label>
        <div class="layui-input-block">
            <input type="checkbox" name="required" lay-skin="switch" th:checked="${field.required ==1?'true':'false'}"/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">补输入</label>
        <div class="layui-input-block">
            <input type="checkbox" name="extInput" lay-skin="switch" th:checked="${field.extInput ==1?'true':'false'}"/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">排序序号</label>
        <div class="layui-input-block">
            <input type="text" name="sorting" lay-verify="required"
                   autocomplete="off" placeholder="请输入排序序号"
                   class="layui-input" th:value="${field.sorting == null || field.sorting <= 0 ? 255 : field.sorting}"/>
        </div>
    </div>
    <div class="layui-form-item layui-hide">
        <input type="hidden" name="id" th:value="${field.id}"/>
        <input type="hidden" name="code" th:value="${field.code == null ?  form.code : field.code}"/>
        <input type="hidden" name="lang" th:value="${lang}"/>
        <button class="layui-btn" lay-submit lay-filter="LAY-field-add-submit" id="LAY-field-add-submit">提交</button>
    </div>
</div>

<script th:src="@{/statics/layui/layui.js}"></script>
<script>
    layui.config({
        base: '/statics/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form'], function () {
        var $ = layui.$
            , form = layui.form;
    })
</script>
</body>
</html>